SEED=0
SIG_LEN=512
SIG_N=1000

DIR_NAME="${PWD##*/}"
REL_PATH=../../../
CUR_PATH=$(pwd)
cd "${REL_PATH}"
PROJ_PATH=$(pwd)
cd "${CUR_PATH}"

EXP_PATH="${CUR_PATH}/exp-$(date "+%Y-%m%d-%H%M%S")"

DATA_GEN_PATH="${PROJ_PATH}/emi_gen"
DATA_PATH="${DATA_GEN_PATH}/datasets/data_${SIG_LEN}_${SIG_N}.txt"


if [[ ! -f ${DATA_PATH} ]]; then
  echo "generate data..."
  cd "${DATA_GEN_PATH}"
  bash gen_lab.sh ${SIG_LEN} ${SIG_N} ${SIG_N} ${SIG_N} ${SIG_N} ${SIG_N} "${DATA_PATH}"
  cd "${CUR_PATH}"
  echo "complete."
else
  echo "data file already exists."
fi


PYTHONPATH=${PYTHONPATH}:${REL_PATH} \
python -u -m cls_solver \
--cfg_path="${CUR_PATH}/config.yaml" \
--log_path="${EXP_PATH}" \
--data_path="${DATA_PATH}" \
--seed=${SEED} \
--input_size=${SIG_LEN} \
--num_classes=5 \
#--ckpt_path= \


RESULT=$(tail "${EXP_PATH}"/log.txt -n 1)
echo ""
echo -e "\033[36mat ${EXP_PATH}:\033[0m"
echo -e "\033[36m[${DIR_NAME}] ${RESULT#*@}\033[0m"
